:ok

Bayesian Computation and Modeling in Python, Exercise 1M21

A probabilistic model

(def result
  (py/with [_ (pm/Model)]
           (let [;; I write about 6 functions every day.
                 functions (pm/Poisson "functions"
                                       :mu 6)
                 ;; The probability of a bug in a function is 1%.
                 p-bug 0.01
                 ;; One day, I had 3 bugs.
                 bugs (pm/Binomial "bugs"
                                   :n functions
                                   :p p-bug
                                   :observed 3)]
             ;; Draw some inference about the number
             ;; of functions I wrote that day.
             {:prior (pm/sample_prior_predictive)
              :inference-data (pm/sample :chains 1)})))

Assumed prior

(vis.python/pyplot
 #(-> result
      :prior
      (py.- prior)
      az/plot_density))

Inferred posterior

(vis.python/pyplot
 #(-> result
      :inference-data
      (py.- posterior)
      az/plot_density))

Visualization using 3dmol

Basic shapes

(shapes-view
 {:width 200 :height 200}
 [[:sphere {:center {:x 0
                     :y 0
                     :z 0}
            :radius 3 :color "green"}]
  [:cylinder {:start {:x 0 :y 10 :z 20}
              :end {:x 10 :y 0 :z 30}
              :radius 2.5 :color :teal :alpha 0.5}]])

An x-y-z dataset

(def points
  (-> (tensor/compute-tensor [3 100]
                             (fn [i j] (-> (rand)
                                           (* 10)
                                           (+ j)
                                           (* 3))))
      (tensor/slice 1)
      (->> (zipmap [:x :y :z]))
      tc/dataset))
points

Turning a dataset into cylinders

(defn dataset->cylinders [dataset options]
  (-> dataset
      (tc/rows :as-maps)
      (->> ((juxt identity rest))
           (apply mapv (fn [xyz0 xyz1]
                         [:cylinder (merge {:start xyz0
                                            :end xyz1}
                                           options)])))))
(-> points
    (dataset->cylinders {:color "purple"}))
[[:cylinder
  {:start
   {:x 21.081374670501184,
    :y 9.259242864260578,
    :z 3.7950157894176515},
   :end
   {:x 4.4070698529171555,
    :y 5.680438814659487,
    :z 29.246372178306675},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 4.4070698529171555,
    :y 5.680438814659487,
    :z 29.246372178306675},
   :end
   {:x 31.104533038318312,
    :y 25.37649507898494,
    :z 30.558941841911007},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 31.104533038318312,
    :y 25.37649507898494,
    :z 30.558941841911007},
   :end
   {:x 22.07949382740123,
    :y 27.447069018368655,
    :z 16.857394888464167},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 22.07949382740123,
    :y 27.447069018368655,
    :z 16.857394888464167},
   :end
   {:x 13.279904852372397,
    :y 23.869999575347776,
    :z 24.726535102755996},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 13.279904852372397,
    :y 23.869999575347776,
    :z 24.726535102755996},
   :end
   {:x 22.89354183301348, :y 33.81679701755446, :z 30.370481219574465},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 22.89354183301348, :y 33.81679701755446, :z 30.370481219574465},
   :end
   {:x 39.289049925818446, :y 34.776976831557, :z 20.888296274085867},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 39.289049925818446, :y 34.776976831557, :z 20.888296274085867},
   :end
   {:x 42.34849767572851,
    :y 28.329681584576647,
    :z 23.462726145948928},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 42.34849767572851,
    :y 28.329681584576647,
    :z 23.462726145948928},
   :end
   {:x 30.489805937650058,
    :y 50.46082520475253,
    :z 49.296226430366154},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 30.489805937650058,
    :y 50.46082520475253,
    :z 49.296226430366154},
   :end
   {:x 55.382966467973915, :y 45.57329909632707, :z 49.99788693096547},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 55.382966467973915, :y 45.57329909632707, :z 49.99788693096547},
   :end
   {:x 31.514520005835934, :y 45.26564517128422, :z 49.11537587319626},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 31.514520005835934, :y 45.26564517128422, :z 49.11537587319626},
   :end
   {:x 54.882218470581776,
    :y 59.036601148652025,
    :z 61.96154870482728},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 54.882218470581776,
    :y 59.036601148652025,
    :z 61.96154870482728},
   :end
   {:x 65.44877620814738, :y 59.04452902940047, :z 44.916463635172654},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 65.44877620814738, :y 59.04452902940047, :z 44.916463635172654},
   :end
   {:x 60.54451709827337, :y 40.71801460212175, :z 65.1495258815098},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 60.54451709827337, :y 40.71801460212175, :z 65.1495258815098},
   :end
   {:x 46.34626716130166, :y 45.661267651965844, :z 49.94285234144931},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 46.34626716130166, :y 45.661267651965844, :z 49.94285234144931},
   :end
   {:x 64.09510040558993, :y 64.70500801928954, :z 55.462479124920556},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 64.09510040558993, :y 64.70500801928954, :z 55.462479124920556},
   :end
   {:x 50.582599411645276,
    :y 68.86896610130394,
    :z 59.392572047885054},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 50.582599411645276,
    :y 68.86896610130394,
    :z 59.392572047885054},
   :end
   {:x 65.1511787542427, :y 79.99522831709483, :z 71.66048385718756},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 65.1511787542427, :y 79.99522831709483, :z 71.66048385718756},
   :end
   {:x 77.7547546161166, :y 69.83296102382977, :z 67.9992471398687},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 77.7547546161166, :y 69.83296102382977, :z 67.9992471398687},
   :end
   {:x 77.56540539956049, :y 77.02269599847651, :z 71.55424189874915},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 77.56540539956049, :y 77.02269599847651, :z 71.55424189874915},
   :end
   {:x 82.3191577615566, :y 69.77209238120068, :z 73.42710353281113},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 82.3191577615566, :y 69.77209238120068, :z 73.42710353281113},
   :end
   {:x 88.9857291731291, :y 86.73122180052577, :z 65.51963385517956},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 88.9857291731291, :y 86.73122180052577, :z 65.51963385517956},
   :end
   {:x 93.48897127774858, :y 78.09046125479333, :z 95.64566004436477},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 93.48897127774858, :y 78.09046125479333, :z 95.64566004436477},
   :end
   {:x 83.21933198455457, :y 83.85138503368916, :z 87.14574121108139},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 83.21933198455457, :y 83.85138503368916, :z 87.14574121108139},
   :end
   {:x 85.77121344934844, :y 72.28622506980042, :z 89.42016694717407},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 85.77121344934844, :y 72.28622506980042, :z 89.42016694717407},
   :end
   {:x 77.95578430910467, :y 80.36296249776382, :z 90.77124276852109},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 77.95578430910467, :y 80.36296249776382, :z 90.77124276852109},
   :end
   {:x 105.5732157300646, :y 92.45033467584761, :z 91.89219240800082},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 105.5732157300646, :y 92.45033467584761, :z 91.89219240800082},
   :end
   {:x 102.20243538231044,
    :y 94.44188867058287,
    :z 106.26844018521787},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 102.20243538231044,
    :y 94.44188867058287,
    :z 106.26844018521787},
   :end
   {:x 86.79313368893351, :y 90.90582703138196, :z 93.57216602209834},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 86.79313368893351, :y 90.90582703138196, :z 93.57216602209834},
   :end
   {:x 91.26076042974772, :y 107.52710512320357, :z 90.49203230090365},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 91.26076042974772, :y 107.52710512320357, :z 90.49203230090365},
   :end
   {:x 119.1843520293859, :y 96.79178422226292, :z 90.61783215109878},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 119.1843520293859, :y 96.79178422226292, :z 90.61783215109878},
   :end
   {:x 120.83500271510786,
    :y 117.52276851171696,
    :z 108.44546900441381},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 120.83500271510786,
    :y 117.52276851171696,
    :z 108.44546900441381},
   :end
   {:x 112.48118082657437,
    :y 117.31836637016755,
    :z 117.94290124048646},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 112.48118082657437,
    :y 117.31836637016755,
    :z 117.94290124048646},
   :end
   {:x 112.40751367870584, :y 99.9181988950786, :z 102.99847427801872},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 112.40751367870584, :y 99.9181988950786, :z 102.99847427801872},
   :end
   {:x 130.50701953147268,
    :y 115.6875692719628,
    :z 131.44541236225248},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 130.50701953147268,
    :y 115.6875692719628,
    :z 131.44541236225248},
   :end
   {:x 117.18490152147385,
    :y 133.21938551531477,
    :z 126.63276723391317},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 117.18490152147385,
    :y 133.21938551531477,
    :z 126.63276723391317},
   :end
   {:x 130.9157257242216,
    :y 109.18296780562815,
    :z 127.65676924713566},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 130.9157257242216,
    :y 109.18296780562815,
    :z 127.65676924713566},
   :end
   {:x 140.26899375380106,
    :y 126.28919310844498,
    :z 127.73088952663761},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 140.26899375380106,
    :y 126.28919310844498,
    :z 127.73088952663761},
   :end
   {:x 118.93177420537337,
    :y 127.91844135499935,
    :z 126.56016468015619},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 118.93177420537337,
    :y 127.91844135499935,
    :z 126.56016468015619},
   :end
   {:x 118.13991557015629,
    :y 143.04648961448453,
    :z 125.66448569826471},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 118.13991557015629,
    :y 143.04648961448453,
    :z 125.66448569826471},
   :end
   {:x 122.31198322153783,
    :y 128.65084500079624,
    :z 147.23865716126386},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 122.31198322153783,
    :y 128.65084500079624,
    :z 147.23865716126386},
   :end
   {:x 125.01920955036188,
    :y 131.32201849191364,
    :z 140.85955924482244},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 125.01920955036188,
    :y 131.32201849191364,
    :z 140.85955924482244},
   :end
   {:x 131.29165600093017,
    :y 144.4336013763117,
    :z 131.58225174801845},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 131.29165600093017,
    :y 144.4336013763117,
    :z 131.58225174801845},
   :end
   {:x 135.41191779588712,
    :y 157.06209273597648,
    :z 153.3034736756618},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 135.41191779588712,
    :y 157.06209273597648,
    :z 153.3034736756618},
   :end
   {:x 143.27715776150853,
    :y 137.94660494876538,
    :z 160.3241187774694},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 143.27715776150853,
    :y 137.94660494876538,
    :z 160.3241187774694},
   :end
   {:x 137.69300315328368,
    :y 136.6741730979033,
    :z 146.41872602872593},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 137.69300315328368,
    :y 136.6741730979033,
    :z 146.41872602872593},
   :end
   {:x 150.33186117841004,
    :y 138.28472928890557,
    :z 167.59599403430917},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 150.33186117841004,
    :y 138.28472928890557,
    :z 167.59599403430917},
   :end
   {:x 163.5778789743202, :y 144.620514067834, :z 159.84748626383987},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 163.5778789743202, :y 144.620514067834, :z 159.84748626383987},
   :end
   {:x 153.1349320632313, :y 168.6207847659521, :z 169.2353924826305},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 153.1349320632313, :y 168.6207847659521, :z 169.2353924826305},
   :end
   {:x 147.4995057152547,
    :y 160.98733401382205,
    :z 159.97338601509955},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 147.4995057152547,
    :y 160.98733401382205,
    :z 159.97338601509955},
   :end
   {:x 155.33342388029965,
    :y 168.25170696012816,
    :z 159.7579732696822},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 155.33342388029965,
    :y 168.25170696012816,
    :z 159.7579732696822},
   :end
   {:x 166.08349598900622,
    :y 177.74288674546392,
    :z 165.04986004372614},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 166.08349598900622,
    :y 177.74288674546392,
    :z 165.04986004372614},
   :end
   {:x 156.47950924773238,
    :y 183.95815220900874,
    :z 183.02632940355755},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 156.47950924773238,
    :y 183.95815220900874,
    :z 183.02632940355755},
   :end
   {:x 166.642250295103, :y 160.66518204072827, :z 164.5882778690736},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 166.642250295103, :y 160.66518204072827, :z 164.5882778690736},
   :end
   {:x 166.57116347563985,
    :y 169.17362270266256,
    :z 187.77993457546745},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 166.57116347563985,
    :y 169.17362270266256,
    :z 187.77993457546745},
   :end
   {:x 185.9694103364452, :y 168.51597369330366, :z 176.2700729708201},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 185.9694103364452, :y 168.51597369330366, :z 176.2700729708201},
   :end
   {:x 195.95824859777053,
    :y 181.52039630592338,
    :z 191.35943834703454},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 195.95824859777053,
    :y 181.52039630592338,
    :z 191.35943834703454},
   :end
   {:x 182.13100599780324, :y 194.0575824004946, :z 180.3973328997174},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 182.13100599780324, :y 194.0575824004946, :z 180.3973328997174},
   :end
   {:x 200.35944637485022, :y 192.4951444310563, :z 198.6745963675367},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 200.35944637485022, :y 192.4951444310563, :z 198.6745963675367},
   :end
   {:x 186.67986859363316,
    :y 206.50774883427061,
    :z 181.58836328368125},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 186.67986859363316,
    :y 206.50774883427061,
    :z 181.58836328368125},
   :end
   {:x 181.6801784781959, :y 208.1237741231892, :z 196.18012693184116},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 181.6801784781959, :y 208.1237741231892, :z 196.18012693184116},
   :end
   {:x 196.88334585570837,
    :y 184.30057626511842,
    :z 203.82413349083677},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 196.88334585570837,
    :y 184.30057626511842,
    :z 203.82413349083677},
   :end
   {:x 200.14728224487894,
    :y 201.60920944636052,
    :z 196.71289777559983},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 200.14728224487894,
    :y 201.60920944636052,
    :z 196.71289777559983},
   :end
   {:x 200.97821179772092,
    :y 190.81510144577777,
    :z 196.7852082310186},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 200.97821179772092,
    :y 190.81510144577777,
    :z 196.7852082310186},
   :end
   {:x 214.65188559703006, :y 193.1807760956678, :z 213.5446348207519},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 214.65188559703006, :y 193.1807760956678, :z 213.5446348207519},
   :end
   {:x 220.47422602554255,
    :y 198.03422096786406,
    :z 201.65911185014897},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 220.47422602554255,
    :y 198.03422096786406,
    :z 201.65911185014897},
   :end
   {:x 223.97383257127177,
    :y 221.22840339380025,
    :z 207.9438857462153},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 223.97383257127177,
    :y 221.22840339380025,
    :z 207.9438857462153},
   :end
   {:x 218.12391152634868,
    :y 206.32467206068088,
    :z 223.9043603528321},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 218.12391152634868,
    :y 206.32467206068088,
    :z 223.9043603528321},
   :end
   {:x 226.2591562557787,
    :y 216.76916159886883,
    :z 221.71678275142057},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 226.2591562557787,
    :y 216.76916159886883,
    :z 221.71678275142057},
   :end
   {:x 234.54090029472928,
    :y 234.08844290276858,
    :z 216.37166636402117},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 234.54090029472928,
    :y 234.08844290276858,
    :z 216.37166636402117},
   :end
   {:x 238.46724462451812,
    :y 222.71422829844025,
    :z 212.45868950377638},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 238.46724462451812,
    :y 222.71422829844025,
    :z 212.45868950377638},
   :end
   {:x 218.38854127211826,
    :y 238.2841338882347,
    :z 221.21642743416356},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 218.38854127211826,
    :y 238.2841338882347,
    :z 221.21642743416356},
   :end
   {:x 236.45277411431246,
    :y 225.4130319513178,
    :z 236.88395356578502},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 236.45277411431246,
    :y 225.4130319513178,
    :z 236.88395356578502},
   :end
   {:x 219.44541998653048,
    :y 225.12456876335744,
    :z 228.7877284304364},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 219.44541998653048,
    :y 225.12456876335744,
    :z 228.7877284304364},
   :end
   {:x 238.00759251858506,
    :y 249.44924439228748,
    :z 233.65181093697225},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 238.00759251858506,
    :y 249.44924439228748,
    :z 233.65181093697225},
   :end
   {:x 248.0620884196031, :y 241.85507105104168, :z 238.2766368406121},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 248.0620884196031, :y 241.85507105104168, :z 238.2766368406121},
   :end
   {:x 244.09021506431867,
    :y 232.8326226840847,
    :z 257.54657033162835},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 244.09021506431867,
    :y 232.8326226840847,
    :z 257.54657033162835},
   :end
   {:x 242.18450392223687,
    :y 255.9805475473451,
    :z 253.93946638952946},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 242.18450392223687,
    :y 255.9805475473451,
    :z 253.93946638952946},
   :end
   {:x 246.43571891110332,
    :y 254.7594321184836,
    :z 243.46263223859197},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 246.43571891110332,
    :y 254.7594321184836,
    :z 243.46263223859197},
   :end
   {:x 240.32841536591155,
    :y 248.39947429643547,
    :z 251.42524335841676},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 240.32841536591155,
    :y 248.39947429643547,
    :z 251.42524335841676},
   :end
   {:x 247.17651259696186,
    :y 255.86398891656353,
    :z 250.7620736909758},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 247.17651259696186,
    :y 255.86398891656353,
    :z 250.7620736909758},
   :end
   {:x 267.9596879235712, :y 256.9556026793741, :z 263.516455225768},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 267.9596879235712, :y 256.9556026793741, :z 263.516455225768},
   :end
   {:x 248.74830011217654,
    :y 255.1750951026311,
    :z 249.07518135950255},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 248.74830011217654,
    :y 255.1750951026311,
    :z 249.07518135950255},
   :end
   {:x 254.63769585256335, :y 260.4049187270053, :z 277.2354862955202},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 254.63769585256335, :y 260.4049187270053, :z 277.2354862955202},
   :end
   {:x 267.32060164773054,
    :y 270.39452274826016,
    :z 279.24861151463523},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 267.32060164773054,
    :y 270.39452274826016,
    :z 279.24861151463523},
   :end
   {:x 278.14530350712937,
    :y 275.92413348475714,
    :z 279.10878967112035},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 278.14530350712937,
    :y 275.92413348475714,
    :z 279.10878967112035},
   :end
   {:x 283.39196094952473,
    :y 267.23737011570324,
    :z 279.0544867049799},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 283.39196094952473,
    :y 267.23737011570324,
    :z 279.0544867049799},
   :end
   {:x 277.5413127481348,
    :y 283.40836995484665,
    :z 269.03101394901955},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 277.5413127481348,
    :y 283.40836995484665,
    :z 269.03101394901955},
   :end
   {:x 280.246393557937, :y 271.6108634167054, :z 275.5894583050053},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 280.246393557937, :y 271.6108634167054, :z 275.5894583050053},
   :end
   {:x 282.3161046122465, :y 280.55104142747206, :z 288.103129813792},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 282.3161046122465, :y 280.55104142747206, :z 288.103129813792},
   :end
   {:x 281.5237564440079, :y 275.05978891708486, :z 286.7482363433344},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 281.5237564440079, :y 275.05978891708486, :z 286.7482363433344},
   :end
   {:x 278.5604587877065, :y 287.4852413893787, :z 302.6161323875883},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 278.5604587877065, :y 287.4852413893787, :z 302.6161323875883},
   :end
   {:x 300.11706446828555,
    :y 304.93430040026897,
    :z 285.3979897259002},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 300.11706446828555,
    :y 304.93430040026897,
    :z 285.3979897259002},
   :end
   {:x 302.254084608494, :y 297.876681446529, :z 286.74626804528066},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 302.254084608494, :y 297.876681446529, :z 286.74626804528066},
   :end
   {:x 308.06581354437856,
    :y 304.44084405866926,
    :z 308.3616087971018},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 308.06581354437856,
    :y 304.44084405866926,
    :z 308.3616087971018},
   :end
   {:x 300.55002101492926,
    :y 304.42662592099657,
    :z 310.19464283773334},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 300.55002101492926,
    :y 304.42662592099657,
    :z 310.19464283773334},
   :end
   {:x 300.2012028880568, :y 289.5245174190751, :z 293.78951835883925},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 300.2012028880568, :y 289.5245174190751, :z 293.78951835883925},
   :end
   {:x 310.5213225783612, :y 292.3526154110851, :z 313.85830026649614},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 310.5213225783612, :y 292.3526154110851, :z 313.85830026649614},
   :end
   {:x 304.0223674486947, :y 318.68143078146073, :z 297.112924584285},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 304.0223674486947, :y 318.68143078146073, :z 297.112924584285},
   :end
   {:x 317.9311944251483, :y 306.9295587482636, :z 321.1661660587043},
   :color "purple"}]]

Showing the cylinders

(-> points
    (dataset->cylinders {:color "purple"
                         :radius 2})
    (->> (shapes-view {:height 200
                       :width 200})))